package com.ubxtech.sms.config;

import com.ubxtech.sms.properties.SmsProperties;
import com.ubxtech.sms.service.SmsPropertiesService;
import com.ubxtech.sms.service.SmsService;
import com.ubxtech.sms.service.impl.SmsPropertiesServiceImpl;
import com.ubxtech.sms.service.impl.SmsServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author Victor.Xiao
 * @since 2023-05-15 10:46
 **/
@Configuration
@Slf4j
@EnableConfigurationProperties(SmsProperties.class)
@ConditionalOnProperty(prefix = SmsProperties.PREFIX, name = "enabled", havingValue = "true", matchIfMissing = true)
public class SmsConfig {

    @Bean
    @ConditionalOnMissingBean
    public SmsPropertiesService xxlJobService() {
        return new SmsPropertiesServiceImpl();
    }


}
